package com.guijianpan.system.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.guijianpan.system.domain.Menu;
import com.guijianpan.system.repository.MenuRepository;

@Service
public class MenuService {
	
	@Autowired
	private MenuRepository menuRepository;

	@Transactional
	public Menu save(Menu menu) {
		return menuRepository.save(menu);
	}

	public List<Menu> findAll() {
		return (List<Menu>) menuRepository.findAll();
	}

	public Menu findOne(Long id) {
		return menuRepository.findOne(id);
	}

	public List<Menu> findFirstLevelMenu() {
		return menuRepository.findFirstLevelMenu();
	}

}
